package com.numberone.master.modules.sys.entity;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.numberone.master.common.persistence.DataEntity;

public class Skill extends DataEntity<Skill>{

	/**
	 * 技能
	 */
	private static final long serialVersionUID = 1L;
	private String id;
	private String name;
	private String no;
	private Complain complain;
	private List<Complain> complainList;
	private String complainNames;
	private User user;
	
	public Skill(User user) {
		this();
		this.user = user;
		// TODO Auto-generated constructor stub
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Skill() {
		super();
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Complain getComplain() {
		return complain;
	}
	public void setComplain(Complain complain) {
		this.complain = complain;
	}
	public List<Complain> getComplainList() {
		return complainList;
	}
	public void setComplainList(List<Complain> complainList) {
		this.complainList = complainList;
	}
	
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	@JsonIgnore
	public List<String> getComplainIdList() {
		List<String> complainIdList = Lists.newArrayList();
		for (Complain complain : complainList) {
			complainIdList.add(complain.getId());
		}
		return complainIdList;
	}
	
	public void setComplainIdList(List<String> complainIdList) {
		complainList = Lists.newArrayList();
		for (String complainId : complainIdList) {
			Complain complain = new Complain();
			complain.setId(complainId);
			complainList.add(complain);
		}
	}
	public String getComplainNames() {
		return complainNames;
	}
	public void setComplainNames(String complainNames) {
		this.complainNames = complainNames;
	}
	
	/*public String getComplainNames() {
		return Collections3.extractToString(complainList, "name", ",");
	}
	public void setComplainNames(String complainNames) {
		this.complainNames = complainNames;
	}
	*/
	
}
